home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / prtcs155.zip / SHELTER.REX < prev    next >
OS/2 REXX Batch file  |  1994-01-14  |  36KB  |  1,142 lines

  1. /*  Shelter WPL Mailers Manager    Williamson */
  2. /* OPTIONS */
  3. do_outs=0   /* if 1, flocvt will queue .OUT files */
  4. /**/
  5. options results
  6. options failat 99
  7. signal on syntax
  8. signal on halt
  9. signal on ioerr
  10. signal on break_c
  11. signal on break_d
  12.  
  13. if ~show('L', "rexxsupport.library") then
  14.     if ~addlib("rexxsupport.library", 0, -30, 0) then do
  15.         say "Couldn't access rexxsupport.library !"
  16.         exit 20
  17.     end
  18. if ~show('L', "RexxDosSupport.library") then
  19.     if ~addlib("RexxDosSupport.library", 2, -30, 0) then do
  20.         say "Couldn't access RexxDosSupport.library !"
  21.         exit 20    
  22.     end
  23. if ~show('L', "hGRexxSupport.library") then
  24.     if ~addlib("hGRexxSupport.library", 2, -30, 0) then do
  25.         say "Couldn't access hGRexxSupport.library !"
  26.         exit 20
  27.     end
  28. if (left(ReadVar('KickStart',"R"),2)) < 37 then do
  29.     say 'Sorry, AmigaDOS Release 2 or higher is required to use Shelter'
  30.     exit 20
  31. end
  32. if ~show("L", "xferq.library") then
  33.     if ~addlib("xferq.library", 0, -30, 0) then do
  34.         say "Couldn't access xferq.library !"
  35.         exit 20
  36.     end
  37. pragma("W","NULL")
  38. Address COMMAND "CD MAIL:"
  39. if RC~=0 then do
  40.     say 'Where is MAIL:?'
  41.     exit 40
  42. end
  43. wpath='CFG:WPL/'
  44. log=show('P',"ROOFLOG")
  45. wfhost=ReadVar('WFHOST')=="TRUE"
  46. pktpri=55
  47. CLS='0C'x; CSI='9b'x;OFF=CSI||'0m';BOLD=CSI||'1m';ULINE=CSI||'4m';ITALICS=CSI||'3;40m'
  48.  
  49. /* get Shelter Mailer Name */
  50. smver=ReadVar('SMVER',"R")
  51. shelter=ReadVar("SHELTER","R")
  52. if shelter="" | shelter = "SHELTER" then do
  53.     Say "No Shelter Mailer available"
  54.     u_shelter="*** NO SHELTER ***"
  55.     signal usage
  56. end
  57. call setup(shelter)
  58. XQ_NOTHING=0;XQ_DELETE=1;XQ_TRUNCATE=2;XQ_IMMEDIATE=4;XQ_SENDLATER=8
  59. DTPRI_HXT=60;DTPRI_CRASH=50;DTPRI_DIRECT=30;DTPRI_NORM=0;DTPRI_HOLD=-50
  60.  
  61. fontsize=8;havewin=0;DoUnLoad=0
  62. PARSE UPPER ARG WHAT WHERE HOW
  63.     if WHAT="" | WHAT="?" then signal usage
  64. Select
  65.     when WHAT="INIT" then do
  66.         call GetVariables
  67.     end
  68.     when WHAT="CALL" then do
  69.         if WHERE="" then signal callusage
  70.         call dial(WHERE,HOW)
  71.     end
  72.     when WHAT="RESTART" then do
  73.         call openwin("P")
  74.         call closemailer(WHAT)
  75.         call closelogs
  76.         options prompt "Generate? (y/N) "
  77.         parse pull ans
  78.         if upper(ans)="Y" then do
  79.             Address REXX GetClip('REXXDIR')'/GenMailer.rexx' u_shelter 'ALL'
  80.             if RC~=0 then exit RC
  81.         end
  82.         call GetVariables()
  83.         if ~DoUnLoad then call raisemailer()
  84.         say "Command: "what" completed"
  85.     end
  86.     when what="AUTO" then do
  87.         call GetVariables()
  88.         call openpscr()
  89.         call openwin("P")
  90.         call loadlogproc()
  91.         call raisemailer()
  92.         call flocvt
  93.         boss_site=GetClip("BOSS")
  94.         parse var boss_site System number
  95.         call dial(System,number,"S")
  96.         if u_shelter="UMBRELLA" then do
  97.             call closemailer(WHAT)
  98.             call closelogs
  99.             call closepscr
  100.         end
  101.     end
  102.     when what="AUTOX" then do
  103.         call GetVariables()
  104.         call openpscr()
  105.         call openwin("P")
  106.         call loadlogproc()
  107.         call raisemailer()
  108.         boss_site=GetClip("BOSS")
  109.         parse var boss_site System number
  110.         call dial(System,number,"S")
  111.         if u_shelter="UMBRELLA" then do
  112.             call closemailer(WHAT)
  113.             call closelogs
  114.             call closepscr
  115.         end
  116.     end
  117.     when WHAT="KILL" then do
  118.         if WHERE="" then signal callusage
  119.         call openwin("S")
  120.         call killdial(WHERE)
  121.     end
  122.     when WHAT="OPENSTATUS" then call openstatus(WHERE)
  123.     when WHAT="CLOSESTATUS" then call closestatus(WHERE)
  124.     when WHAT="EXIT" then do
  125.         call openwin("S")
  126.         call closemailer(WHAT)
  127.         call closelogs
  128.         call closepscr
  129.     end
  130.     when WHAT="FLOCVT" then do
  131.         call openwin("S")
  132.         call flocvt()
  133.         say "Command: "what" completed"
  134.     end
  135.     when WHAT="ADDWORK" then do
  136.         call openwin("P")
  137.         call addwork(WHERE,HOW)
  138.         say "Command: "what" completed"
  139.     end
  140.     when WHAT="POLL" then do
  141.         call openwin("S")
  142.         call dopolls(WHERE)
  143.         say "Command: "what" completed"
  144.     end
  145.     when WHAT="CLEAN" then do
  146.         call openwin("P")
  147.         call cleanxq()
  148.         say "Command: "what" completed"
  149.     end
  150.     when WHAT="START" then do
  151.         if WHERE ~="" & WHERE ~="WHERE" then call setup(WHERE)
  152.         call GetVariables()
  153.         call openpscr()
  154.         call openwin("P")
  155.         call loadlogproc()
  156.         call raisemailer()
  157.         call addwork("BADPASSWORD","CFG:PASSWORD.BAD L 75")
  158.         if exists(rexxdir||'Sctl.rexx') then address AREXX rexxdir||'Sctl.rexx'
  159.         say "Command: "what" completed"
  160.     end
  161.     otherwise Say 'Unknown command:'what
  162. end /*select*/
  163. /*
  164. if havewin=1 then do
  165.     call close('STDIN')
  166.     call close('STDOUT')
  167. end
  168. */
  169. exit 0
  170.  
  171. loadlogproc:
  172.     if ~showlist('p','LOGPROC') then do
  173.         Address COMMAND "run >nil: logproc"
  174.         say "Waiting for LogProc Port"
  175.         Address COMMAND "waitforport LOGPROC"
  176.         say "Log port ready"
  177.     end
  178.     if ~showlist('p','LOGPROC') then do
  179.         say "Unabled to access LOGPROC"
  180.         exit 10
  181.     end
  182. return
  183.  
  184. raisemailer:
  185.     logfile=GetClip('LOGFILE')
  186.     if logfile="" then logfile="MAIL:Shelter.LOG"
  187.     Say  "Opening "logfile
  188.     Address "LOGPROC"
  189.     'OpenLog' file 'f' logfile
  190.  
  191.     logwindow=GetClip('LOGWINDOW')
  192.     if index(logwindow,":")=0 then 'AddLogGroup' fgroup file
  193.     else do
  194.         logwindow=logwindow||"/SCREEN"||GetClip('SCREEN')
  195.         Say  "Opening "logwindow
  196.         'OpenLog' fwindow 'w' logwindow
  197.         'AddLogGroup' fgroup file fwindow
  198.     end
  199.     Address
  200.     slave=0
  201.     PutLog('Opened log 'logfile date())
  202.  
  203.     slave=1
  204.     if show('P',mport||slave) then do
  205.         say mport||slave 'already active'
  206.         exit 10
  207.     end
  208.     if ~show('p',"sushi_CAS_port") then do
  209.         PutLog('Loading Sushi')
  210.         address COMMAND "Run Sushi <>NULL: ON NOPROMPT ASKSAVE"
  211.         call SetCLip('MYSUSHI',"TRUE")
  212.     end
  213.  
  214.     PutLog('Loading 'u_shelter' Mailer')
  215.     pcmd="ChangeTaskPri 1"||'0a'x
  216.     scmd="Stack 50000"||'0a'x
  217.  
  218.     do i=1 to wscount
  219.         parse var wsrc.i wscript.i '.' x
  220.         lcmd='LoadScript' lower(wscript.i) wpath||wsrc.i
  221.         cmd=scmd||pcmd||lcmd
  222.         address COMMAND cmd
  223.         stat=RC
  224.         if stat ~=0 then do
  225.             PutLog(lcmd 'returned' stat', did you note the error or forget to generate the Mailer?')
  226.             DoUnLoad=1;signal unloadscripts
  227.             exit
  228.         end
  229.     end
  230.     PutLog('Launching 'u_shelter'0')
  231.     cmd=scmd||pcmd||'Launch 'u_shelter'0 'l_shelter'!startup 0 30000'
  232.     address COMMAND cmd
  233.     stat=RC
  234.     if stat ~=0 then PutLog(cmd 'returned' stat)
  235. return 0
  236.  
  237. closemailer:
  238.     call putlog('Closing slaves')
  239.     if u_shelter~="UMBRELLA" then ports=GetClip('SLAVES')
  240.     else ports=1
  241.     do i=ports to 1 by -1
  242.         if show('p',mport||i) then do
  243.             call PutLog('Closing:'mport||i)
  244.             address VALUE mport||i
  245.             'Set exit 'arg(1)
  246.             call delay(10) 
  247.             'ABORT'
  248.             do while show('p',mport||i)
  249.                 call delay(10)
  250.             end
  251.         end
  252.         call delay(100)
  253.     end
  254. unloadscripts:
  255.     call putlog('Flushing mailer')
  256.     do i=1 to wscount
  257.         parse var wsrc.i wscript.i '.' x
  258.         ulcmd='LoadScript' lower(wscript.i) '""'
  259.         address COMMAND ulcmd
  260.         stat=RC
  261.         if stat~=0 then call PutLog(ulcmd 'returned' stat)
  262.         call closestatus(i)
  263.     end
  264.     if show('P','sushi_CAS_port') then do
  265.         if GetCLip('MYSUSHI')="TRUE" then do
  266.             call PutLog("Closing Sushi")
  267.             address COMMAND "sushi OFF"
  268.         end
  269.     end
  270. return 0
  271.  
  272. closelogs:
  273.     call putlog('Closing logs')
  274.     address "LOGPROC"
  275.     'Closelog 'file
  276.     logwindow=GetClip('LOGWINDOW')
  277.     if index(logwindow,":") > 0 then 'CloseLog' fwindow
  278.     'RemLogGroup 'fgroup
  279. return
  280.  
  281. closestatus:
  282. slave=arg(1)
  283. if u_shelter="UMBRELLA" then slave=1
  284. address "LOGPROC"
  285. 'Closelog 'window||slave
  286. 'RemLogGroup' wgroup||slave
  287. Address
  288. return 0
  289.  
  290. openstatus:
  291. if u_shelter="UMBRELLA" then slave=1
  292.     else slave=arg(1)
  293. if ~show('P',mport||slave) then do
  294.     PutLog(mport||slave 'not active')
  295.     exit 10
  296. end
  297. rws.specs=GetClip('WSPEC')
  298. if rws.specs="" then rws.specs="NOSIZE/NODEPTH/INACTIVE"
  299. rws.x=0 ; rws.y=10 ; rws.chars=80 ; rws.lines=7 ; rws.text='@f3@R'
  300. rws.0='   Status'copies(" ",53)'H_Freqs'copies(" ",10)
  301. rws.1=' Response'copies(" ",13)'Login'copies(" ",35)'R_Freqs'copies(" ",10)
  302. rws.2='     Baud'copies(" ",13)'H_Adr'copies(" ",35)'Inbound'copies(" ",10)
  303. rws.3='   Number'copies(" ",13)'R_Adr'copies(" ",35)'Domain'copies(" ",10)
  304. rws.4=' Password'copies(" ",13)'Sysop'copies(" ",52)
  305. rws.5='  Session'copies(" ",13)'H_Ofr'copies(" ",52)
  306. rws.6=' Protocol'copies(" ",13)'R_Ofr'copies(" ",52)
  307. p.1="p.status   @1,10,53 @R"
  308. p.2="p.response @2,10,13 @R"
  309. p.3="p.baud     @3,10,13 @R"
  310. p.4="p.number   @4,10,13 @R"
  311. p.5="p.password @5,10,13 @R"
  312. p.6="p.session  @6,10,13 @R"
  313. p.7="p.protocol @7,10,13 @R"
  314. p.8="p.login   @2,28,35 @R"
  315. p.9="p.host    @3,28,35 @R"
  316. p.10="p.remote  @4,28,35 @R"
  317. p.11="p.rsysop   @5,28,52 @R"
  318. p.12="p.hoffer   @6,28,52 @R"
  319. p.13="p.roffer   @7,28,52 @R"
  320. p.14="p.hfreqs   @1,70,10 @R"
  321. p.15="p.rfreqs   @2,70,10 @R"
  322. p.16="p.inbound  @3,70,10 @R"
  323. p.17="p.domain   @4,70,10 @R"
  324. positions=17
  325.  
  326. if u_shelter~="UMBRELLA" then do
  327.     slavewindows=getwindows()
  328.     if slavewindows~=0 then rws.y=rws.y+(w_height(rws.lines)*slavewindows)
  329. end
  330. Address VALUE mport||slave
  331. 'String $(device) $(unit) $(modem)'
  332. minfo=mport||slave strip(RESULT)
  333. xspec='RAW:'rws.x'/'rws.y'/'w_width(rws.chars)'/'w_height(rws.lines)'/The 'u_shelter' Mailer v'smver' 'minfo'/'rws.specs'/SCREEN'GetClip('SCREEN')
  334. address "LOGPROC"
  335. 'OpenLog' window||slave "'w'" xspec
  336. 'AddLogGroup' wgroup||slave window||slave
  337. do i=0 to rws.lines
  338.     'PutLine' wgroup||slave  '@'i+1',1' rws.text||rws.i||copies(" ",rws.chars-length(rws.i))
  339. end
  340.  
  341. Address VALUE mport||slave
  342. do i=1 to positions
  343.     'Set' word(p.i,1) '"'subword(p.i,2)'"'
  344. end
  345. Address
  346. return 0
  347.  
  348. getwindows: procedure expose l_shelter
  349.     slavewindows=0
  350.     Address LOGPROC 'Show "l"'
  351.     logs=RESULT
  352.     if words(logs)=0 & slave > 1 then return slave-1
  353.     if words(logs)=0 then return 0
  354.     do i=1 to words(logs)
  355.         if index(word(logs,i),l_shelter'ss') > 0 then slavewindows=slavewindows+1
  356.     end
  357. return slavewindows
  358.  
  359. dial:
  360. System=arg(1)
  361. Number=arg(2)
  362. lmode=arg(3)
  363. if Number="NUMBER" then Number=""
  364. else number="NUMBER "Number
  365. if u_shelter="ROOF" then address COMMAND "RUN >NIL: CALL" System Number
  366. else do
  367.     if lmode="S" then Address "REXX" GetClip('REXXDIR')"/Scall" System Number
  368.     else Address "AREXX" GetClip('REXXDIR')"/Scall" System Number
  369. end
  370. return
  371.  
  372. killdial:
  373. if ~datatype(arg(1),'MIXED') then site_address=make5d(arg(1))
  374. else site_address=arg(1)
  375. call SetClip("S"||site_address,'abort')
  376. PutLog('Call to 'site_address' will be aborted on next attempt')
  377. return
  378.  
  379. callcleanup:
  380. call PutLog('Removing 'site_address' from dial queue')
  381. call SetClip("S"||site_address,"")
  382. return 0
  383.  
  384. make5d: procedure expose dd z n f p
  385. da=arg(1)
  386. select
  387.     when index(da, "#") > 0 then parse var da dd "#" z ":" n "/" f "." p
  388.     when index(da, ":") > 0 then parse var da z ":" n "/" f "." p
  389.     when index(da, "/") > 0 then parse var da n "/" f "." p
  390.     when index(da, ".") > 0 then parse var da f "." p
  391.     when left(da, 1)="." then parse var da "." p
  392.     otherwise parse var da f .
  393. end
  394. myaddress.domain=GetClip('DOMAIN')
  395. cfgaddress=GetClip('HOST.ADDRESS.'||myaddress.domain)
  396. parse var cfgaddress myaddress.zone ":" myaddress.net "/" myaddress.node "." myaddress.point
  397.  
  398. if p="" | p='P' then p='0'
  399. if n="" | n='N' then n=myaddress.net
  400. if f="" | f='F' then f=myaddress.node
  401. if z="" | z='Z' then z=myaddress.zone
  402. if dd="" | dd='DD' then do
  403.     dl=GetClip('DOMAINLIST')
  404.     dd=0
  405.     x=find(dl,z)
  406.     if x~=0 then dd=word(dl,x-1)
  407.     if dd=0 then dd=myaddress.domain
  408. end
  409.  
  410. if ~datatype(z,'n') | ~datatype(n,'n') | ~datatype(f,'n') | ~datatype(p,'n') then do
  411.     call PutLog('make5d: Invalid address ['da']')
  412.     return 0
  413. end
  414. drop da
  415. if myaddress.domain"#"cfgaddress=dd'#'z':'n'/'f'.'p
  416. then p=0
  417. return(dd'#'z':'n'/'f'.'p)
  418.  
  419. flocvt:
  420. outdir=addslash(dequote(GetClip('OUTDIR')))
  421. flodir=addslash(dequote(GetClip('FLODIR')))
  422. call PutLog('Searching for FLO files in' flodir)
  423. Address COMMAND 'LIST >t:flofilelist 'flodir||'#?.#?.#?.#?.?LO quick nohead'
  424. if word(statef("T:flofilelist"),2)=0 then do
  425.     call PutLog('No ?LO files in' outdir)
  426.     Signal scanout
  427. end
  428.  
  429. if ~open('flolist',"t:flofilelist",'R') then do
  430.     call PutLog("Error opening 4D .FLO list")
  431.     return 10
  432. end
  433. i=0
  434. do forever
  435.     Line=Upper(strip(space(ReadLn('flolist'),1),'B'))
  436.     if EOF('flolist') then Leave
  437.     if Line="" then iterate
  438.     i=i+1
  439.     node.i=Line
  440.     parse var Line flonode.i.zone "." flonode.i.net "." flonode.i.node "." flonode.i.point "." junk
  441.     flonode.i.domain=find_domain(flonode.i.zone)
  442.     flonode.i.pri="0"
  443.  
  444.     floadr=flonode.i.zone":"flonode.i.net"/"flonode.i.node"."flonode.i.point
  445.     if Left(junk,1)="C" then flonode.i.pri=DTPRI_CRASH
  446.     if Left(junk,1)="H" then flonode.i.pri=DTPRI_HOLD
  447.     if Left(junk,1)="D" then flonode.i.pri=DTPRI_DIRECT
  448.     if Left(junk,1)="N" then flonode.i.pri=DTPRI_NORM
  449.     if Left(junk,1)="F" then flonode.i.pri=DTPRI_NORM
  450. end
  451. call close('flolist')
  452. if i=0 then do
  453.     call PutLog("Error: No 4D ?LO Files found in" flodir)
  454.     drop flonode floadr
  455.     call delete("T:flofilelist")
  456.     return 0
  457. end
  458. flonode.numnodes=i
  459. do anode=1 until anode=flonode.numnodes
  460.     drop flags
  461.     floadr=flonode.anode.zone':'flonode.anode.net'/'flonode.anode.node'.'flonode.anode.point
  462.     call PutLog("Converting" node.anode "for" floadr)
  463.     jnode=left(node.anode,length(node.anode)-3)
  464.     floname=upper(flodir||jnode||Left(right(node.anode,3),1)||"LO")
  465.     call PutLog("floname:"floname)
  466.  
  467.     flonode.anode.domain=find_domain(flonode.anode.zone)
  468.  
  469.     site=flonode.anode.domain||"#"||flonode.anode.zone||":" ,
  470.         ||flonode.anode.net||"/"||flonode.anode.node||"."||flonode.anode.point
  471.     PutLog('Site:'site,10,10)
  472.     if u_shelter="ROOF" then myaddress.domain=GetClip('DOMAIN')
  473.     else myaddress.domain=GetClip('FTNDOMAIN')
  474.     cfgaddress=GetClip('HOST.ADDRESS.'||myaddress.domain)
  475.     parse var cfgaddress myaddress.zone ":" myaddress.net "/" myaddress.node "." myaddress.point
  476.  
  477.     err=0
  478.     if ~exists(floname) then do
  479.         call PutLog("Error: Can't find "floname)
  480.         call drop_vars
  481.         err=1
  482.     end
  483.     else if ~Open('flofile',floname,'R') then do
  484.         call PutLog("Error: Can't open" floname)
  485.         call drop_vars
  486.         err=1
  487.     end
  488.  
  489.     site_address=XfqGetAddress(site)
  490.     if ~err then do
  491.         do forever
  492.             Line=upper(ReadLn('flofile'))
  493.             if eof('flofile') then Leave
  494.             if Line="" then Iterate
  495.  
  496.             flags=XQ_NOTHING
  497.             if (LEFT(Line,1)="#") then do
  498.                 flags=XQ_TRUNCATE
  499.                 Line=DELSTR(Line,1,1)
  500.             end;else if (LEFT(Line,1)="^") | (LEFT(Line,1)="-") then do
  501.                 flags=XQ_DELETE
  502.                 Line=DELSTR(Line,1,1)
  503.             end;else if (LEFT(Line,1)="@") then do
  504.                 flags=XQ_NOTHING
  505.                 Line=DELSTR(Line,1,1)
  506.             end
  507.             if ~exists(Line) then do
  508.                 call PutLog("File "Line" No Longer Exists")
  509.                 Iterate
  510.             end
  511.  
  512.             if right(Line,4) = ".TIC" then do
  513.                 flags=XQ_DELETE
  514.                 sendas=get_fn(Line)
  515.             end;else if right(Line,2)="UT" then do
  516.                 Line=move_out(Line)
  517.                 sendas=get_packetname()
  518.                 if Left(right(Line,3),1)="C" then t.pri=DTPRI_HXT
  519.                 if Left(right(Line,3),1)="H" then t.pri=DTPRI_HOLD
  520.                 if Left(right(Line,3),1)="D" then t.pri=DTPRI_DIRECT
  521.                 if Left(right(Line,3),1)="N" then t.pri=DTPRI_NORM
  522.                 if Left(right(Line,3),1)="F" then t.pri=flonode.anode.pri
  523.             end;else do
  524.                 parse var Line x '.' x '.' x '.' x '.' ext
  525.                 if ext="" then do
  526.                     sendas=get_fn(Line)
  527.                     flags=XQ_NOTHING
  528.                     t.pri=flonode.anode.pri
  529.                 end;else do
  530.                     tmpext=upper(left(ext,2))
  531.                     if datatype(right(ext,1),'n') & (tmpext="MO" | tmpext="TU" | tmpext="WE" | tmpext="TH" | tmpext="FR" | tmpext="SA" | tmpext="SU")  then do
  532.                         sendas=UPPER(d2x(65536+myaddress.net-flonode.anode.net,4)||d2x(65536+myaddress.node-flonode.anode.node,4)||'.'ext)
  533.                         flags=XQ_DELETE
  534.                         t.pri=flonode.anode.pri
  535.                     end
  536.                 end
  537.                 drop ext x
  538.             end
  539.             call PutLog(Line' as 'sendas' for:'floadr' Disp:'flags' Pri:'t.pri)
  540.             QUERY.XQ_NAME=line
  541.             QUERY.XQ_SITE=site_address
  542.             work=NULL
  543.             work=XfqFindWork(QUERY)
  544.             if work=NULL then do
  545.                 call PutLog("File "line" not in "site" queue, adding as "sendas)
  546.                 XfqAddWorkQuick(site,Line,sendas,t.pri,flags)
  547.             end;else do
  548.                 call PutLog("File "line" re-queued")
  549.                 call XfqUnlockWork(work)
  550. /*                call XfqDropObject(work)  */
  551.             end
  552.         end /*forever*/
  553.     end /* flofile */
  554.     call close('flofile')
  555.     call delete(floname)
  556.     call XfqFlushQueue(site_address)
  557.     call XfqDropObject(site_address)  
  558.     if work~=NULL then call XfqDropObject(work)  
  559. end
  560. call XfqClose()
  561. call drop_vars
  562. call delete("T:flofilelist")
  563. scanout:
  564. call PutLog('Searching for .?UT files in' outdir)
  565. Address COMMAND 'LIST >t:outlist 'outdir||'#?.#?.#?.#?.?UT quick nohead'
  566. if word(statef("T:outlist"),2)=0 then do
  567.     call PutLog('No ?UT files in' outdir)
  568.     Return
  569. end
  570. if ~open('outs',"t:outlist",'R') then do
  571.     call PutLog("Error opening 4D .?UT list")
  572.     return 10
  573. end
  574. do while ~eof('outs')
  575.     outfile=upper(readln('outs'))
  576.     if outfile="" then iterate
  577.     parse var outfile oz '.' on '.' of '.' op '.' ext
  578.     if ~do_outs & ext="OUT" then do
  579.         PutLog('Skipping 'outfile)
  580.         Iterate
  581.     end
  582.     xtype=left(ext,1)
  583.     if xtype="C" then flonode.i.pri=DTPRI_HXT
  584.     else if xtype="H" then flonode.i.pri=DTPRI_HOLD
  585.     else if xtype="D" then flonode.i.pri=DTPRI_DIRECT
  586.     else if xtype="N" then flonode.i.pri=DTPRI_NORM
  587.     else if xtype="O" then flonode.i.pri=DTPRI_NORM
  588.     else do
  589.         call PutLog('ERROR: cannot queue 'outfile)
  590.         Iterate
  591.     end
  592.     drop xtype
  593.     call addwork(oz':'on'/'of'.'op,outdir||outfile "D" flonode.i.pri)
  594. end  
  595. call delete("T:outlist")
  596. return
  597.  
  598. move_out:
  599.     call makedir(outdir||"PKT")
  600.     newline=outdir||"PKT/"get_fn(arg(1))
  601.     Address COMMAND 'Copy 'arg(1) newline
  602.     call delete(arg(1))
  603. return newline
  604.  
  605. addwork:
  606. site_address=arg(1)
  607. qaz=space(arg(2),1)
  608. parse var qaz file disposition priority .
  609. PutLog('Addwork:'site_address file disposition priority)
  610. if ~datatype(site_address,"MIXED") then do
  611. isftn=1;site_address=make5d(site_address)
  612. end;else do
  613. isftn=0;site=site_address
  614. end
  615. if site_address=0 then return
  616. if file="" | ~(exists(file)) then do
  617.     PutLog('Cannot find ['file']')
  618.     return 1
  619. end
  620. file=upper(file)
  621. select
  622.     when disposition="D" then flags=XQ_DELETE
  623.     when disposition="T" then flags=XQ_TRUNCATE
  624.     when disposition="L" then flags=XQ_NOTHING
  625.     otherwise flags=XQ_NOTHING
  626. end
  627. if datatype(priority,"MIXED") then do
  628.     priority=value("DTPRI_"priority)
  629.     prispec=1
  630. end;else do
  631.     prispec=0
  632.     select
  633.     when priority > 50 then nop
  634.     when priority > 30 then priority=DTPRI_CRASH
  635.     when priority > 0 then priority=DTPRI_DIRECT
  636.     when priority=0 then priority=DTPRI_NORM
  637.     when priority=-50 then priority=DTPRI_HOLD
  638.     otherwise priority=DTPRI_CRASH
  639.     end
  640. end
  641. if ~isftn then sendas=get_fn(file)
  642. else do
  643.     if right(file,4)=".CUT" | right(file,4)=".DUT" | right(file,4)=".HUT" | right(file,4)=".OUT" then do
  644.         sendas=get_packetname()
  645.         flags=XQ_DELETE
  646.     end
  647.     else if right(file,4)=".PKT" then do
  648.         sendas=get_fn(file)
  649.         flags=XQ_DELETE
  650.         if ~prispec then priority=DTPRI_HXT
  651.     end
  652.     else if right(file,4)=".TIC" then do
  653.         sendas=get_fn(file)
  654.         flags=XQ_DELETE
  655.     end;else do
  656.         parse var file td'.'tz'.'tn'.'tf'.'tp'.'ext .
  657.         if ext ~= "" then call addarcmail
  658.         else do
  659.             parse var file tz'.'tn'.'tf'.'tp'.'ext .
  660.             if ext ~= "" then call addarcmail
  661.             else sendas=get_fn(file)
  662.         end
  663.         drop td tz tn tf tp ext tmpext j
  664.     end
  665.     dd=find_domain(z)
  666.     site=dd||"#"||z||":"||n||"/"||f||"."||p
  667. end
  668. site_address=XfqGetAddress(site)
  669. QUERY.XQ_NAME=file
  670. QUERY.XQ_SITE=site_address
  671. work=NULL
  672. work=XfqFindWork(QUERY)
  673. if work=NULL then do
  674.     PutLog("File "file" not in site queue, adding")
  675.     XfqAddWorkQuick(site,file,sendas,priority,flags)
  676. end;else do
  677.     PutLog("File "file" already queued")
  678.     if work ~=NULL then call XfqUnlockWork(work)
  679. end
  680. /*call XfqDropObject(work)  */
  681. call XfqFlushQueue(site_address)
  682. call XfqDropObject(site_address)  
  683. if work ~=NULL then do
  684.     if isftn then call PutLog('Queued 'file' as 'sendas' for 'dd'#'z':'n'/'f'.'p' Pri:'priority 'Dsp:'flags)
  685.     else call PutLog('Queued 'file' as 'sendas' for 'site' Pri:'priority 'Dsp:'flags)
  686. end
  687. call XfqClose()
  688. return
  689.  
  690. addarcmail:
  691. if u_shelter="ROOF" then myaddress.domain=GetClip('DOMAIN')
  692. else myaddress.domain=GetClip('FTNDOMAIN')
  693. cfgaddress=GetClip('HOST.ADDRESS.'||myaddress.domain)
  694. parse var cfgaddress myaddress.zone ":" myaddress.net "/" myaddress.node "." myaddress.point
  695. tmpext=upper(left(ext,2))
  696. if datatype(right(ext,1),'n') & (tmpext="MO" | tmpext="TU" | tmpext="WE" | tmpext="TH" | tmpext="FR" | tmpext="SA" | tmpext="SU")  then do
  697. sendas=UPPER(d2x(65536+myaddress.net-tn,4)||d2x(65536+myaddress.node-tf,4)||'.'ext)
  698. flags=XQ_DELETE
  699. return 1
  700. end
  701. return 0
  702.  
  703. dopolls:
  704.     minpri=arg(1)
  705.     if minpri="" | minpri='MINPRI' then minpri=0
  706.     else do
  707.         minpri=value("DTPRI_"minpri)-1
  708.         PutLog('Polling only Priority >'minpri)
  709.     end
  710.     call PutLog('Scheduling Polls')
  711.     sitelist=XfqGetSiteList()
  712.     call XfqWalkSession(sitelist,sitearray)
  713.     if sitearray.numentries=1 then call PutLog("There is 1 site in the queue")
  714.         else call PutLog("There are "sitearray.numentries" sites in the queue")
  715.     do loop = 1 to sitearray.numentries
  716.         MaxPri=XfqMaxSitePri(sitearray.loop)
  717.         addrtags.XQ_Mandatory=511
  718.         addrtags.XQ_Optional=511
  719.         System = upper(XfqPutAddress(sitearray.loop,addrtags))
  720.         if System="BADPASSWORD" then Iterate
  721.         PutLog("Site:"System" Pri:"MaxPri)
  722.  
  723.         if (MaxPri<-1)|(MaxPri>120) then Iterate   
  724.  
  725.         if System="BADADDRESS" then iterate
  726.         if System~="" then do
  727.             if MaxPri>MinPri then do
  728.                 call PutLog('Calling:' System)
  729.                 call dial(System)
  730.             end;else do
  731.                 call PutLog('Not calling: 'System' Pri:'MaxPri)
  732.             end
  733.         end
  734.     end
  735.     call XfqDropObject(sitelist)  
  736.     call XfqClose()
  737. return 0
  738.  
  739.  
  740. cleanxq:
  741.     sitelist=XfqGetSiteList()
  742.     call XfqWalkSession(sitelist,sitearray)
  743.     call PutLog("There are "sitearray.numentries" sites in the queue")
  744.     do loop = 1 to sitearray.numentries
  745.         addrtags.XQ_Mandatory = 511 /* XQADDR_ANYTHING */
  746.         addrtags.XQ_Optional = 511  /* XQADDR_ANYTHING */
  747.         System = XfqPutAddress(sitearray.loop,addrtags)
  748.         call XfqWalkQueue(sitearray.loop,thestem)
  749.         call PutLog("There are "thestem.NUMENTRIES" files for "System)
  750.         do i=1 to thestem.NUMENTRIES
  751.             call PutLog("Sending "thestem.i.NAME" as "thestem.i.ASNAME" at priority "thestem.i.PRI) 
  752.             if ~EXISTS(thestem.i.NAME) then do
  753.                 call PutLog("File "thestem.i.NAME" does not exist")
  754.                 FINDIT.XQ_NAME = thestem.i.NAME
  755.                 FINDIT.XQ_SITE = sitearray.loop
  756.                 work = XfqFindWork(FINDIT)
  757.                 if(work=NULL) then call PutLog("Someone got to it before us!")
  758.                 else do
  759.                     call XfqRemoveWork(work)
  760. /*                    call XfqDropObject(work)  */
  761.                 end
  762.             end
  763.         end
  764.     end
  765.     call XfqDropObject(sitelist)  
  766.     call XfqClose()
  767. return thestem.NUMENTRIES
  768.  
  769. getakey:
  770.     options PROMPT "Hit a key"
  771.     parse pull junk
  772. return
  773.  
  774. get_packetname:
  775. pktspec="CFG:packet_spec"
  776. if ~open('out',pktspec,'R') then call PutLog("Can't read "pktspec)
  777. else do
  778.     packet_spec=readln('out')
  779.     call close('out')
  780.     drop out
  781. end
  782. tspec=left(date(),2)||compress(time(),":")
  783. if (tspec=packet_spec) then tspec=tspec+1
  784. do while exists(outdir||""||tspec".PKT")
  785.     tspec=tspec+1
  786. end
  787. if ~open('out',pktspec,'W') then call PutLog("Can't write new "pktspec)
  788. else do
  789.     call writeln('out',tspec)
  790.     call close('out')
  791.     drop out
  792. end
  793. return(tspec||".PKT")
  794.  
  795. get_fn: procedure
  796. if LastPos('/', arg(1)) ~=0 then return SubStr(arg(1), LastPos('/', arg(1)) + 1)
  797.     else if LastPos(':', arg(1)) ~=0 then return SubStr(arg(1), LastPos(':', arg(1)) + 1)
  798.         else return arg(1)
  799.  
  800. find_domain: procedure
  801. dl=GetClip('DOMAINLIST')
  802. dz=FIND(dl,arg(1))
  803. if dz=0 then return GetClip('DOMAIN')
  804. else return strip(word(dl,dz-1))
  805.  
  806. drop_vars:
  807. drop tonode. flonode. hisaddress. work err line
  808. drop floadr site site_address i file pktname floname sendas flags disposition priority
  809. return 0
  810.  
  811. GetVariables: procedure expose envpath u_shelter
  812. /* copy ENV variables to Clips */
  813. say "Loading environment"
  814. mv.1="SCREEN        1"
  815. mv.2="LOGFILE       0"
  816. if u_shelter="ROOF" then mv.3="DOMAIN        1"
  817.     else mv.3="FTNDOMAIN        1"
  818. mv.4="DOMAINLIST    1"
  819. mv.5="INDIR         1"
  820. mv.6="OUTDIR        1"
  821. mv.7="XFERQ         1"
  822. mv.8="REXXDIR       1"
  823. mv.9="REDIALDELAY   1"
  824. mv.10="BUSYDELAY    1"
  825. mv.11="IGNORENOANSWER   1"
  826. mv.12="CALLWINDOWMIN    1"
  827. mv.13="DOMAINAWARE      1"
  828. mv.14="WSPEC        1"
  829. mv.15="WPOS         0"
  830. mv.16="SSPEC        0"
  831. mv.17="SPOS         0"
  832. mv.18="BOSS         0"
  833. mv.19="LOGWINDOW    0"
  834. mv.20="POLLWIN      1"
  835. mv.21="XPRWIN       0"
  836. mv.22="FLODIR       1"
  837. numclips=22
  838. if (u_shelter="ROOF" | u_shelter="PORTICUS") then do
  839. mv.23="MENUS        1"
  840. mv.24="SYSOPBASE    1"
  841. mv.25="FREQDIR      0"
  842. numclips=25
  843. end
  844.  
  845. do i=1 to numclips
  846.     if ~SetClip(upper(word(mv.i,1)),ReadVar(word(mv.i,1))) then do
  847.         if strip(word(mv.i,2))=0 then say "Warning: Variable "word(mv.i,1)" is not set"
  848.         else do
  849.             say "Error: Variable "word(mv.i,1)" is not set "envpath GetVar(envpath||word(mv.i,1),"G")
  850.             exit 10
  851.         end
  852.     end
  853. end
  854. call SetClip('DOMAIN',GetClip('FTNDOMAIN'))
  855. liblist.1="rexxsupport.library"
  856. liblist.2="OwnDevUnit.library"
  857. liblist.3="XferQ.library"
  858. liblist.4="xprzedzap.library"
  859. liblist.5="xprfts.library"
  860. liblist.6="wpl.library"
  861. liblist.7="wplemsi.library"
  862. liblist.8="RexxDosSupport.library"
  863. reqdlibs=8
  864. say "Checking for required libraries"
  865. do i=1 to reqdlibs
  866.     parse var liblist.i libname level .
  867.     if ~exists('LIBS:'||libname) then do
  868.         say 'Missing required library LIBS:'libname', please investigate'
  869.         exit 20
  870.     end
  871. end
  872. /* Directories to create*/
  873. dir.1=GetClip('INDIR')
  874. dir.2=GetClip('OUTDIR')
  875. dir.3=GetClip('FREQDIR')
  876. dir.4=GetClip('FLODIR')
  877. dir.5=GetClip('INDIR')||"/NONSECURE"
  878. dir.6=GetClip('INDIR')||"/RESUME"
  879. dir.7=GetClip('INDIR')||"/FTNSORT"
  880. dir.8=GetClip('XFERQ')
  881. dirs=8
  882. if u_shelter="ROOF" | u_shelter="PORTICUS" then do
  883. dir.9=GetClip('INDIR')||"/USERS"
  884. dir.10="LOG:rfsacct"
  885. dir.11="LOG:rfsacct/h"
  886. dir.12="LOG:/FREQIT"
  887. dir.13="CFG:/FREQIT"
  888. dirs=13
  889. end
  890. say "Checking for required directories"
  891. do i=1 to dirs
  892.     call makedir(dir.i)
  893. end
  894.  
  895. address COMMAND 'Assign XFERQ:' GetClip('XFERQ')
  896. domain=GetClip('DOMAIN')
  897. Address COMMAND "Echo >XFERQ:hostaddr" domain"#"GetClip('HOST.ADDRESS.'domain)
  898. singleinbound=GetClip('DOMAINAWARE')=="TRUE"
  899. dl=GetClip('DOMAINLIST')
  900. indir=GetClip('INDIR')
  901. outdir=GetClip('OUTDIR')
  902. do ftn=1 to words(dl)-1 by 2
  903.     if ~singleinbound then do
  904.         call makedir(indir||'/'||word(dl,ftn))
  905.         call makedir(outdir||'/'||word(dl,ftn))
  906.     end
  907.     vname="HOST.ADDRESS."||upper(word(dl,ftn))
  908.     if ~SetClip(vname,ReadVar(vname)) then do
  909.         say "Error: Variable "vname" is not set"
  910.         exit 10
  911.     end
  912. end
  913. if u_shelter="PORTICUS" then Address REXX GetClip('REXXDIR')"/PRODCFG DO"
  914. return
  915.  
  916. ReadVar: procedure expose ENVPATH
  917.     if arg(2)="R" then x=GetVar(arg(1),"G")
  918.     else x=GetVar(envpath||arg(1),"G")
  919. return x
  920.  
  921. lower:
  922. return(bitor(arg(1),'20'x))
  923.  
  924. PutLog:  procedure expose fgroup u_shelter slave log havewin
  925. if havewin=1 then say arg(1)
  926. if slave="SLAVE" then slave="MGR"
  927. if log=1 then address 'ROOFLOG' 'logline' left(time(),5) 'SMM: 'arg(1)
  928. address 'LOGPROC' 'PutLog 'fgroup time() u_shelter||slave': 'arg(1)
  929. return 0
  930.  
  931. w_height: procedure expose fontsize
  932. BAR=13 /* TOP BORDER + BOTTOM BORDER */
  933. if fontsize="" then fontheight=8
  934.     else fontheight=fontsize
  935. return ((arg(1)*fontheight)+BAR)
  936.  
  937. w_width: procedure expose fontsize
  938. BORDER=10 /* LEFT BORDER + RIGHT BORDER */
  939. if fontsize="" then fontwidth=8
  940.    else fontwidth=fontsize
  941. return ((arg(1)*fontwidth)+BORDER)
  942.  
  943. addslash:
  944. curr=arg(1)
  945. select
  946. when right(curr, 1)=":" then nop
  947. when right(curr, 1)="/" then nop  /* TackOn */
  948. otherwise curr=curr"/"
  949. end
  950. return curr
  951. /* a useful procedure by Walt Sullivan    */
  952. dequote: procedure
  953. parse arg thing
  954. parse var thing '"' unq_thing '"'
  955. if unq_thing ~="" then return unq_thing
  956. return thing
  957.  
  958.  
  959. break_c:
  960. break_d:
  961. call callcleanup()
  962. PutLog('User Aborted 'what where)
  963. exit 0
  964. novalue:
  965. call template_oops "Novalue" sigl
  966. syntax:
  967. call template_oops "Syntax(RC=" || RC || ")" sigl RC
  968. failure:
  969. call template_oops "Failure(RC=" || RC || ")" sigl
  970. ioerr:
  971. call template_oops "IOErr(RC=" || RC || ")" sigl
  972. halt:
  973. call template_oops "Halt" sigl
  974. template_oops:
  975. parse arg what badline code
  976. if code~="" then call PutLog("ERROR LINE:"badline errortext(code))
  977.     else call PutLog("ERROR LINE:"badline what)
  978. cleanup:
  979. call XfqClose()
  980. exit(40)
  981.  
  982. /**/
  983. usage:
  984. say CLS
  985. if shelter="" then do
  986.     Say "No Shelter Mailer available"
  987.     u_shelter="*** NO SHELTER ***"
  988. end
  989. say BOLD||u_shelter" Mailer Manager"||OFF" v"smver
  990. say ITALICS"   Usage: Shelter <command> <options>"OFF
  991. say BOLD"       START"OFF"          - load mailer"
  992. say BOLD"       EXIT"OFF"           - unload mailer"
  993. say BOLD"       RESTART"OFF"        - unload, compile and reload mailer"
  994. if u_shelter="UMBRELLA" then say BOLD"       AUTO"OFF"           - load,convert,call Boss and exit"
  995. else say BOLD"       AUTO"OFF"           - load, convert and call Hub"
  996. say
  997. say BOLD"       ADDWORK"OFF" site fullfilename (disposition) (priority)"
  998. say "                      - add a file to a site queue"
  999. SAY "                        disposition:"
  1000. SAY "                        D=delete, T=truncate, L=do nothing (default)"
  1001. SAY "                        priority: (-128 to +128)      (default CRASH)"
  1002. SAY "                        or HOLD=-50, NORM=0, DIRECT=30, CRASH=50"
  1003. say BOLD"       FLOCVT"OFF"         - convert 4d ?LO/?UT files to XferQ"
  1004. say BOLD"       CLEAN"OFF"          - remove non-existing files from queue"
  1005. say
  1006. callusage:
  1007. if u_shelter~="UMBRELLA" then do
  1008. say BOLD"       CALL"OFF" site (CRASH|NOPICKUP|phonenumber|line) (line)"
  1009. say "                      - start a site poll"
  1010. say "                        site=[domain#][z:][net/]node[.p]"
  1011. say "                        site=uu(sitename) | clock(n) | bbs/fax_(sitename)"
  1012. say BOLD"       KILL"OFF" site      - abort a site poll"
  1013. say BOLD"       POLL"OFF" (priority) - poll all non-HOLD sites with pending mail"
  1014. say "                        priority = NORMAL, DIRECT, CRASH" 
  1015. end;else do
  1016. say BOLD"       CALL"OFF" site (number)"
  1017. say "                     - start a site poll"
  1018. say BOLD"       KILL"OFF" site"
  1019. say "                     - abort a site poll"
  1020. say "                        site=[domain#][z:][net/]node[.p]"
  1021. end
  1022. exit 0
  1023. /**/
  1024.  
  1025. openpscr:
  1026.     pscreen=ReadVar('SCREEN')
  1027.     if upper(pscreen)="WORKBENCH SCREEN" then return
  1028.     Interpret include('CFG:SCREEN.CFG')
  1029.     if SCREENPREFS="" | SCREENPREFS="SCREENPREFS" then do
  1030.         Say "Error reading CFG:SCREEN.CFG"
  1031.         exit 20
  1032.     end
  1033.     parse var SCREENPREFS width','height','planes
  1034.     colors=2**planes
  1035.     parse var SCREENFONT font','fontsize
  1036.     modes=translate(SCREENMODES," ",",")
  1037.     globals=translate(SCREENGLOBALS," ",",")
  1038.     if pos('AUTOCLOSE',globals)>0 & pos('WAIT',GetClip(sspec))=0 then do
  1039.         Say "Error: cannot open a non-WAIT window on an AUTOCLOSE screen"
  1040.         exit 20
  1041.     end;else do
  1042.         call SetClip("SSMAUTOCLOSE","TRUE")
  1043.     end
  1044.     cxx=translate(SCREENCX,' "',",'")
  1045.     if index(modes,"L") ~=0 then textoverscan_height=TEXTOVERSCAN_HEIGHT*2
  1046.     rgball=""
  1047.     do i=0 to colors-1
  1048.         if RGB.i="" then leave
  1049.         rgball=rgball||d2x(word(RGB.i,1))||d2x(word(RGB.i,2))||d2x(word(RGB.i,3))||','
  1050.     end
  1051.     rgball=delstr(rgball,lastpos(',',rgball),1)
  1052.     if width>640 then t_width=width-TEXTOVERSCAN_WIDTH
  1053.         else t_width=0
  1054.     if height>230 then t_height=height-TEXTOVERSCAN_HEIGHT
  1055.         else t_height=0
  1056.     if t_width~=0 | t_height~=0 then sz='SIZE=OSCAN_TXT:0,0,+'t_width',+'t_height' DISPCLIP=OSCAN_TEXT'
  1057.         else sz='SIZE='width','height
  1058.     if SCREENPEN="" | SCREENPENS="SCREENPENS" then opts= sz 'PLANES='planes 'COLORS='rgball 'MODE='modes 'FONT='font'.'fontsize globals cxx
  1059.         else opts= sz 'PLANES='planes 'PENS='SCREENPENS 'COLORS='rgball 'MODE='modes 'FONT='font'.'fontsize globals cxx
  1060.     cmd='ScreenManager OPEN "'pscreen'"' opts
  1061.     Say 'Executing:'cmd
  1062.     address COMMAND cmd
  1063.     if RC~=0 then say "Could not open screen:" pscreen
  1064.     else call setclip('SMMPSCREEN','TRUE')
  1065. return
  1066.  
  1067. closepscr:
  1068.     if GetClip('SMMAUTOCLOSE')="TRUE" then return
  1069.     pscreen=GetClip('SCREEN')
  1070.     if upper(pscreen)="WORKBENCH SCREEN" then return
  1071.     myscreen=GetClip('SMMPSCREEN')
  1072.     if upper(myscreen)~="TRUE" then return
  1073.     call SetClip('SMMPSCREEN',"")
  1074.     call close('STDIN')
  1075.     call close('STDOUT')
  1076.     call delay(50)
  1077.     address COMMAND 'ScreenManager CLOSE "'pscreen'"'
  1078. return
  1079.  
  1080. setup:
  1081. shelter=arg(1)
  1082. u_shelter=upper(shelter)
  1083. l_shelter=lower(shelter)
  1084. call SetClip('SHELTER',u_shelter)
  1085. if u_shelter="ROOF" then envpath=""
  1086. else envpath=shelter"/"
  1087.  
  1088. callscript="S:"||left(u_shelter,1)||"CALL"
  1089. file=l_shelter'file'
  1090. fwindow=l_shelter'win'
  1091. fgroup=l_shelter'wpl'
  1092. window=l_shelter'ss'
  1093. wgroup=l_shelter'wplstat'
  1094. mport=u_shelter
  1095. if (u_shelter="UMBRELLA" | u_shelter="GAZEBO") then do
  1096.     wsrc.1=l_shelter'CFG.wpl'
  1097.     wsrc.2=l_shelter'MODEM.wpl'
  1098.     wsrc.3=l_shelter'.wpl'
  1099.     wscount=3
  1100. end;else do
  1101.     if ReadVar('MENUS')="FILE" then do
  1102.         wsrc.1=l_shelter'CFG.wpl'
  1103.         wsrc.2=l_shelter'MODEM.wpl'
  1104.         wsrc.3=l_shelter'NOTIFY.wpl'
  1105.         wsrc.4=l_shelter'.wpl'
  1106.         wscount=4
  1107.     end;else do
  1108.         wsrc.1=l_shelter'CFG.wpl'
  1109.         wsrc.2=l_shelter'MENUS.wpl'
  1110.         wsrc.3=l_shelter'MODEM.wpl'
  1111.         wsrc.4=l_shelter'NOTIFY.wpl'
  1112.         wsrc.5=l_shelter'.wpl'
  1113.         wscount=5
  1114.     end
  1115. end
  1116. return
  1117.  
  1118. openwin:
  1119. wpos=GetClip('WPOS')
  1120. if wpos="" | wpos="WPOS" then wpos="0/80/600/40"
  1121. wspec=GetClip('WSPEC')
  1122. if wspec="" | wspec="WSPEC" then wspec="INACTIVE/AUTO/WAIT"
  1123. spos=GetClip('SPOS')
  1124. if spos="" | spos="SPOS" then spos="0/80/600/80"
  1125. sspec=GetClip('SSPEC')
  1126. if sspec="" | sspec="SSPEC" then sspec="INACTIVE/AUTO/WAIT"
  1127. if arg(1)="P" then win='CON:'spos'/'u_shelter' Mailer Manager v'smver' [Click to Close]/'sspec'/SCREEN'
  1128. else if arg(1)="S" then win='CON:'wpos'/'u_shelter' Mailer Manager v'smver'/'wspec'/SCREEN'
  1129. else return
  1130. call close('STDOUT')
  1131. pscreen=ReadVar('SCREEN')
  1132. call open('STDOUT',win||pscreen,'W')
  1133. call close('STDIN')
  1134. call open('STDIN','*','R')
  1135. havewin=1
  1136. return
  1137.  
  1138. isftn:
  1139.     if datatype(arg1,"N") then return 1
  1140.     if pos(arg(1),"#")>0 | pos(arg(1),":")>0 | pos(arg(1),"/")>0 then return 1
  1141. return 0
  1142.